package cn.com.scitc.soft2101.dao;

import cn.com.scitc.soft2101.db.MyBatisHelper;
import cn.com.scitc.soft2101.mapper.UserMapper;
import cn.com.scitc.soft2101.model.User;
import org.apache.ibatis.session.SqlSession;

public class UserDao {
    public User findById(Integer id) {
        try (SqlSession session = MyBatisHelper.getSessionFactory().openSession()) {
            UserMapper mapper = session.getMapper(UserMapper.class);
            return mapper.selectByPrimaryKey(id);
        }
    }

//    public User findByLoginId(String loginId) {
//        try (SqlSession session = MyBatisHelper.getSessionFactory().openSession()) {
//            UserMapper mapper = session.getMapper(UserMapper.class);
//            return mapper.selectByLoginId(loginId);
//        }
//    }
}
